<template>

	<view class="nav-body">

		<cu-custom bgColor="bg-gradual-pink" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">地址管理</block>
		</cu-custom>
		<view class="margin-top page-top"></view>

		<view class="cu-list menu">
			<view class="cu-item arrow" v-for="(item) in data"  @click="upd(item)">
				<view class="content" >
					<!-- <image src="/static/icon/nav/1.png"></image> -->
					<text class="cuIcon-discoverfill text-orange"></text>
					<text class="text-grey">{{item.fullName}}</text>
				</view>
				<view class="action" v-if="item.isDefault">
					<view class="cu-tag round bg-olive light">默认</view>
				</view>
			</view>
		</view>
		<view class="padding flex flex-direction">
			<button class="cu-btn bg-blue lg" @click="add()">新建地址</button>
		</view>
	</view>
	</scroll-view>
	</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: {},
			};
		},
		onLoad() {
			this.userInfo = this.userDefaultInfo;
		},
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function() {
			this.init();
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			// 添加
			add() {
				uni.navigateTo({
					url: "/pages/fpage4/address/addAddress",
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			// 编辑
			upd(item) {
				uni.navigateTo({
					url: "/pages/fpage4/address/updAddress?id="+ item.id,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			// 加载页面逻辑 http://www.dmoe.cc/random.php
			init() {
				this.crud.get(this.path, "/api/client/all/address/findPage").then(res => {
					this.data = res.data.data.records;
				})
			},

		}
	}
</script>

<style>
	/* 顶部菜单 */
	.cu-custom .bg-gradual-pink {
		height: 160upx !important;
		min-height: 160upx !important;
		color: #ffffff !important; // 导航字体颜色
		background-image: linear-gradient(45deg, #ff55ff, #ffaaff) !important; // 主页面导航背景颜色
		z-index: 10000;
	}

	.page {
		height: 100vh;
		width: 100vw;
	}

	.page.show {
		overflow: hidden;
	}

	.switch-sex::after {
		content: '\e716';
	}

	.switch-sex::before {
		content: '\e7a9';
	}

	.switch-music::after {
		content: '\e66a';
	}

	.switch-music::before {
		content: '\e6db';
	}

	/* 文字展示位置设置 */
	.user {
		height: 20vh;
		width: 100vw;
	}

	.userIcon {
		margin-top: 6vh;
		margin-left: 5vw;
	}

	.userName {
		position: absolute;
		margin-top: 6.5vh;
		margin-left: 2vw;
	}

	.userId {
		position: absolute;
		margin-top: 10vh;
		margin-left: 2vw;
	}

	.userSignature {
		position: absolute;
		margin-top: 14vh;
		margin-left: 2vw;
	}
</style>
